{% extends "base.volt" %}

{% block pageFooter%}
    {{ javascript_include("/assets/manage/js/om/openCityList.js", false) }}
{% endblock %}

{% block content %}
    {{ partial("module/left_om") }}
    <div class="col-xs-10">
        <ol class="breadcrumb">
            <li>开通城市管理</li>
            <li class="active">开通城市列表</li>
        </ol>

		<div class="panel panel-default">
            <div class="panel-body">
                <form class="form-inline" role="form" action="" method="get">
                    <div class="form-group">
                        <div class="input-group">
                            <label class="input-group-addon">城市</label>
                            <select class="form-control" name="filterCity" id="filterCity">
                                <option value="-10000" {{ filterCity == -10000 ? 'selected="selected"' : '' }}>全部</option>
                                {% for oc in openCity %}
                                    <option value="{{ oc.city_id }}" {{ filterCity == oc.city_id ? 'selected="selected"' : '' }} >{{ oc.city_name|e }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <label class="input-group-addon">状态</label>
                            <select class="form-control" name="filterState" id="filterState">
                                <option value="-10000" {{ filterState == -10000 ? 'selected="selected"' : '' }} >全部</option>
                                <option value="1" {{ filterState == 1 ? 'selected="selected"' : '' }} >开通</option>
                                <option value="0" {{ filterState == 0 ? 'selected="selected"' : '' }} >关闭</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-primary"><i class="fa fa-filter"></i> 搜 索</button>
                    </div>
                    <div class="form-group">
                    	
                    </div>
                </form>
                <div class="row">
            		<div class="col-xs-12 text-center">
                		<button durl="{{ url.get('om/openCityAdd') }}" class="btn btn-primary but_add_city"><i class="fa fa-plus fa-lg"></i> 添加城市</button>
            		</div>
        		</div>
            </div>
        </div>

        <table class="table table-hover">
            <thead>
            <tr>
                <th>ID</th>
                <th>城市</th>
                <th>开通时间</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            </thead>
            {% for d in data %}
            <tr>
                <td>{{ d.city_id }}</td>
                <td>{{ d.city_name|e }}</td>
                <td>{{ d.city_addtime }}</td>
                <td>{{ GeneralStateValue2Str(d.city_state) }}</td>
                <td>
                    {% if d.city_state == 0 %}
                   <a class="but_set_state btn btn-primary" href="javascript:void(0)" did="{{ d.city_id }}" dstate="1" durl="{{ url.get('om/openCitySetState') }}">开通</a>
                    {% endif %}
                    {% if d.city_state == 1 %}
                    <a class="but_set_state btn btn-primary" href="javascript:void(0)" did="{{ d.city_id }}" dstate="0" durl="{{ url.get('om/openCitySetState') }}">关闭</a>
                    {% endif %}
                    <!-- <li><a class="but_set_order" did="{{ d.city_id }}" durl="{{ url.get('om/openCitySetOrder') }}" dtitle="{{ d.city_name|escape_attr }}" dorder="{{ d.city_order }}" href="javascript:void(0)"><i class="fa fa-puzzle-piece fa-fw"></i> 更新排序值</a></li>
                    <li role="separator" class="divider"></li>
                    {% if d.city_state == 0 %}
                    <li><a href="javascript:void(0)" did="{{ d.city_id }}" dstate="1" class="but_set_state" durl="{{ url.get('om/openCitySetState') }}"><i class="fa fa-paper-plane-o fa-fw"></i> 发 布</a></li>
                    {% endif %}
                    {% if d.city_state == 1 %}
                    <li><a href="javascript:void(0)" did="{{ d.city_id }}" dstate="-1" class="but_set_state" durl="{{ url.get('om/openCitySetState') }}"><i class="fa fa-trash-o fa-fw"></i> 删 除</a></li>
                    {% endif %}
                    {% if d.city_state == -1 %}
                    <li><a href="javascript:void(0)" did="{{ d.city_id }}" dstate="0" class="but_set_state" durl="{{ url.get('om/openCitySetState') }}"><i class="fa fa-reply fa-fw"></i> 恢 复</a></li>
                    {% endif %} -->
                </td>
            </tr>
            {% endfor %}
        </table>
    </div>
{% endblock %}